package com.huibo.shopping.common.config;

import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;

import springfox.documentation.builders.ApiInfoBuilder;
import springfox.documentation.builders.PathSelectors;
import springfox.documentation.builders.RequestHandlerSelectors;
import springfox.documentation.service.ApiInfo;
import springfox.documentation.service.Contact;
import springfox.documentation.spi.DocumentationType;
import springfox.documentation.spring.web.plugins.Docket;
import springfox.documentation.swagger2.annotations.EnableSwagger2;

@Configuration
@EnableSwagger2
public class BaseConfig {
	@Bean
	public Docket getDocket() {
		return new Docket(DocumentationType.SWAGGER_2)
				.apiInfo(getApi())
				.select()
				.apis(RequestHandlerSelectors.basePackage("com.huibo.shop.common.controller"))
				.paths(PathSelectors.any())
				.build();
	}
	
	public ApiInfo getApi() {
		return  new ApiInfoBuilder()
				.title("公共服务API")
				.description("公共服务接口文档说明")
				.contact(new Contact("keke","","1019510181@qq.com"))
				.version("1.0")
				.build();
	}
}
